package com.bskj.bms.bean.vo;

import com.bskj.common.bean.model.ShopCoupon;
import com.bskj.common.enums.CouponLimitModeTypeEnum;
import com.bskj.common.enums.CouponTimeTypeEnum;
import com.bskj.common.enums.ShopCouponValidTypeEnum;

public class ShopCouponVo extends ShopCoupon {
	public String getCouponLimit() {
		String couponLimit = "暂时未设置";
		if (getLimitModeType() != null) {
			if (getLimitModeType() == CouponLimitModeTypeEnum.Time_Number_Type.getKey()) {
				if (getCouponLimitType() != null) {
					couponLimit = String.format("%s限制%s张", CouponTimeTypeEnum.get(getCouponLimitType()).getValue(),
							getCouponLimitNum());
				}
			} else if (getLimitModeType() == CouponLimitModeTypeEnum.Inventory_Type.getKey()) {
				couponLimit = String.format("剩余库存%s张", getInventory());
			}
		}
		return couponLimit;
	}

	public String getMoneys() {
		String moneys = "";
		if (getCouponMoneyType() == 2) {
			moneys = "全免";
		} else {
			moneys = "￥" + (getMoney() / 10) + ".00元";
		}
		return moneys;
	}

	public String getCouponRule() {
		String couponRule = "";
		if (getValidType() == ShopCouponValidTypeEnum.coupon_crtain.getKey()) {
			double time = getValidTime();
			int hour = (int) time;
			couponRule = "领取后" + hour + "小时" + (int) ((time - hour) * 60) + "分钟之内有效";
		} else {
			couponRule = "领取当日" + getLastTime() + "前有效";
		}
		return couponRule;
	}

	public void setMoneys(Double moneys) {
		setMoney(moneys.intValue() * 10);
	}
}
